package com.wb3.meta.common.utils;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.chrono.IsoChronology;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;

/**
 * 时间函数 工具类
 */
@Slf4j
public class TimeUtils {

	/**
	 * 每秒的毫秒数
	 */
	public static final long MILLIS_PER_SECOND = 1000L;
	/**
	 * 每分钟秒数
	 */
	public static final int SECOND_PER_MINUTE = 60;
	/**
	 * 每小时的秒数
	 */
	public static final int SECOND_PER_HOUR = 3600;
	/**
	 * 每天的秒数
	 */
	public static final int DaySecondCounts = 86400;
	/**
	 * 一周的天数
	 */
	public static final int DaysOfAWeek = 7;

	/**
	 * 标准的每天 凌晨5点的时间
	 */
	public static final int StandardFiveSeconds = 18000;

	/**
	 * 缓存一个固定的时间搓  主要用于计算一些差值方便  防止一些 int数据溢出
	 */
	@Getter
	private static long centuryYearSecond = 0;

	static final int fiveSeconds = 17995; //5*60*60 - 5 = 18000 - 5 = 17995
	/**
	 * 默认的时区信息
	 */
	@Getter
	private static final ZoneOffset zoneOffset = OffsetDateTime.now().getOffset();

	@Getter
	private static final ZoneOffset zoneOffsetFive = ZoneOffset.ofTotalSeconds (OffsetDateTime.now().getOffset().getTotalSeconds() - 5*60*60);

	/**
	 * 时间转换信息
	 */
	static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

	static final DateTimeFormatter dateTimeFormatterTencent = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm");

	static final DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");

	static final DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");

	static {
		//7月1日 是周一（必须是周一）
		centuryYearSecond = TimeUtils.getTimeByString("2019-07-01 00:00:00");
	}

	/**
	 * 每分钟毫秒数
	 */
	public static final long MILLIS_PER_MINUTE = SECOND_PER_MINUTE * MILLIS_PER_SECOND;

	public static final int SECOND_PER_WEEK = DaysOfAWeek * DaySecondCounts;

	private static final long START_MILLIS = System.currentTimeMillis();
	private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat();

	/**
	 * 程序启动时间(毫秒)(距离 1970.1.1)
	 *
	 * @return
	 */
	public static long startTimeMillis() {
		return START_MILLIS;
	}

	/**
	 * 程序运行了多长时间(毫秒)
	 *
	 * @return
	 */
	public static long runTimeMillis() {
		return System.currentTimeMillis() - START_MILLIS;
	}

	/**
	 * 当前系统时间戳(毫秒)(距离 1970.1.1 UTC时间)
	 *
	 * @return
	 */
	public static long currentTimeMillis() {
		return System.currentTimeMillis();
	}

	/**
	 * 当前系统时间戳(秒)(距离 1970.1.1 UTC时间)
	 *
	 * @return
	 */
	public static long currentTimeSeconds() {
		return (System.currentTimeMillis() / MILLIS_PER_SECOND);
	}

	/**
	 * 当前年
	 *
	 * @return
	 */
	public static int currentYear(long timeMillis) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(timeMillis / MILLIS_PER_SECOND, 0, zoneOffset);
		return localDateTime.getYear();
	}

	/**
	 * 当前月[1,12]
	 *
	 * @return
	 */
	public static int currentMonth(long timeMillis) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(timeMillis / MILLIS_PER_SECOND, 0, zoneOffset);
		return localDateTime.getMonthValue();
	}

	/**
	 * 当前月中日[1,31]
	 *
	 * @return
	 */
	public static int currentDay(long timeMillis) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(timeMillis / MILLIS_PER_SECOND, 0, zoneOffset);
		return localDateTime.getDayOfMonth();
	}

	/**
	 * 当前月中日[1,31],按五点算下一天
	 *
	 * @return
	 */
	public static int currentDayFive() {
		return currentDay((currentTimeSeconds() - StandardFiveSeconds) * MILLIS_PER_SECOND);
	}
	/**
	 * 当前时钟[0,23]
	 *
	 * @return
	 */
	public static int currentHour() {
		int nowDaySecond = (int) ((currentTimeSeconds() - centuryYearSecond) % DaySecondCounts);
		return nowDaySecond / SECOND_PER_HOUR;
	}

	/**
	 * 当前分钟[0,59]
	 *
	 * @return
	 */
	public static int currentMinute() {
		int nowDaySecond = currentSecondNowDay(currentTimeSeconds());
		return (nowDaySecond % SECOND_PER_HOUR) / SECOND_PER_MINUTE;
	}

	/**
	 * 获取 秒数量 [0- 3600*24]
	 *
	 * @param second
	 * @return
	 */
	public static int currentSecondNowDay(long second) {
		return (int) ((second - centuryYearSecond) % DaySecondCounts);
	}

	/**
	 * 当前日期,精确到日, 年月日格式, 格式: yyyyMMdd, 例如: 20161207
	 *
	 * @return
	 */
	public static int currentCHSYYYYMMDD() {
		return currentCHSYYYYMMDD(currentTimeSeconds());
	}
	/**
	 * 当前日期,精确到小时, 年月日时格式, 格式: yyyyMMddHH, 例如: 2016120704
	 *
	 * @return
	 */
	public static int currentCHSYYYYMMDDHH() {
		return currentCHSYYYYMMDDHH(currentTimeSeconds());
	}
	/**
	 * 当前日期,精确到日, 年月日格式,按五点算, 格式: yyyyMMdd, 例如: 20161207
	 *
	 * @return
	 */
	public static int currentCHSYYYYMMDDFive() {
		return currentCHSYYYYMMDD(currentTimeSeconds() - StandardFiveSeconds);
	}

	/**
	 * 当前日期,精确到日, 年月日格式, 格式: yyyyMMdd, 例如: 20161207
	 *
	 * @return
	 */
	public static int currentCHSYYYYMMDD(long second) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(second, 0, zoneOffset);
		return localDateTime.getYear() * 10000
				+ localDateTime.getMonthValue() * 100
				+ localDateTime.getDayOfMonth();
	}

	/**
	 * 当前日期,精确到小时, 年月日时格式, 格式: yyyyMMddHH, 例如: 2016120704
	 *
	 * @return
	 */
	public static int currentCHSYYYYMMDDHH(long second) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(second, 0, zoneOffset);
		return localDateTime.getYear() * 1000000
				+ localDateTime.getMonthValue() * 10000
				+ localDateTime.getDayOfMonth() * 100
				+ localDateTime.getHour();
	}

	/**
	 * 获得当前时刻周一的日期
	 *
	 * @return
	 */
	public static int currentCHSYYYYMMDDMonday(long second) {
		long s = (centuryYearSecond + ((second - centuryYearSecond) / DaySecondCounts) * DaySecondCounts);
		long week_1_7 = getWeekDay(s);
		s = s - (week_1_7 - 1)*DaySecondCounts;

		return currentCHSYYYYMMDD(s);
	}

	/**
	 * 当前日期,精确到日, 年月日格式, 格式: MMdd, 例如: 1207
	 *
	 * @return
	 */
	public static int currentCHSMMDD(long second) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(second, 0, zoneOffset);
		return 	localDateTime.getMonthValue() * 100
				+ localDateTime.getDayOfMonth();
	}

	/**
	 * 格式: DDHHMM, 例如: 071855
	 *
	 * @return
	 */
	public static int currentCHSDDHHMM(long second) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(second, 0, zoneOffset);
		return localDateTime.getDayOfMonth() * 10000
				+ localDateTime.getHour() * 100
				+ localDateTime.getMinute();
	}

	public static int currentCHSDDHHMM() {
		return currentCHSDDHHMM(currentTimeSeconds());
	}

	/**
	 * eg 20200101
	 *
	 * @return
	 */
	public static long getDayBeginSecond(int yyyyMMdd) {
		int year = yyyyMMdd / 10000;
		int month = ((yyyyMMdd % 10000) / 100);
		int day = yyyyMMdd % 100;
		LocalDateTime localDateTime = LocalDateTime.of(year, month, day, 0, 0, 0);
		return localDateTime.toEpochSecond(zoneOffset);
	}

	/**
	 * eg 20200101
	 * 当前时刻相当于yyyyMMdd 是第几天 当天算1
	 *
	 * @return
	 */
	public static int getDays1Since(int yyyyMMdd) {
		long second = getDayBeginSecond(yyyyMMdd);
		long now = TimeUtils.currentTimeSeconds();
		if (now == second) {
			return 1;
		}

		long diff = now - second;
		return (int) (diff / DaySecondCounts) + 1;
	}

	/** 获得两个时间相差几天  yyyyMMdd_1 < yyyyMMdd_2
	 * 格式 20200101
	 *
	 * @return
	 */
	public static int getDays1Since(int yyyyMMdd_1, int yyyyMMdd_2) {
		long second_1 = getDayBeginSecond(yyyyMMdd_1);
		long second_2 = getDayBeginSecond(yyyyMMdd_2);
		if (second_2 < second_1) {
			return 0;
		}
		if (second_2 == second_1) {
			return 1;
		}

		long diff = second_2 - second_1;
		return (int) (diff / DaySecondCounts) + 1;
	}

	/**
	 * YYYYMM
	 *
	 * @param second
	 * @return
	 */
	public static int currentCHSYYYYMM(long second) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(second, 0, zoneOffset);
		return localDateTime.getYear() * 100
				+ localDateTime.getMonthValue();
	}

	/**
	 * 当前日期,精确到日, 年月日格式, 格式: yyyyMMddHHmmSS, 例如: 2016-12-07 14:50:32
	 *
	 * @return
	 */
	public static String currentYYYYMMDDHHMMSSStr() {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(currentTimeSeconds(), 0, zoneOffset);
		return dateTimeFormatter.format(localDateTime);
	}

	/**
	 * 获取当月的天数
	 *
	 * @param second
	 * @return
	 */
	public static int getDaysOfMonth(long second) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(second, 0, zoneOffset);
		return localDateTime.getMonth().length(IsoChronology.INSTANCE.isLeapYear(localDateTime.getYear()));
	}

	/**
	 * 获取指定月的天数
	 *
	 * @return
	 */
	public static int getDaysOfMonth() {
		return getDaysOfMonth(currentTimeSeconds());
	}
	/**
	 * 获取指定月的天数,按五点算
	 *
	 * @return
	 */
	public static int getDaysOfMonthFive() {
		return getDaysOfMonth(currentTimeSeconds() - StandardFiveSeconds);
	}
	/**
	 * 获取当前时间日期的格式化字符串
	 *
	 * @param pattern
	 * @return
	 */
	public static String currentDateTimeFormat(String pattern) {
		return getDateTimeFormat(pattern, System.currentTimeMillis());
	}

	/**
	 * 获取特定时间的格式化字符串
	 *
	 * @param pattern
	 * @return
	 */
	public static String getDateTimeFormat(String pattern, long timeMillis) {
		SIMPLE_DATE_FORMAT.applyPattern(pattern);
		return SIMPLE_DATE_FORMAT.format(timeMillis);
	}

	public static long secondToMillis(long second) {
		return second * MILLIS_PER_SECOND;
	}

	/**
	 * 是否是同一天 单位：秒
	 *
	 * @param time1
	 * @param time2
	 * @return
	 */
	public static boolean IsDiffDay(long time1, long time2) {
		if (GetDiffDayNum(time1, time2) == 0) {
			return false;
		} else {
			return true;
		}
	}

	public static boolean IsDiffDayFive(long time1, long time2) {
		if (GetDiffDayNumFive(time1, time2) == 0) {
			return false;
		} else {
			return true;
		}
	}

	/**
	 * 获得两个时间点相差的天数
	 *
	 * @param time1
	 * @param time2
	 * @return
	 */
	public static int GetDiffDayNum(long time1, long time2) {
		return (int) ((time1 - centuryYearSecond) / DaySecondCounts) - (int) ((time2 - centuryYearSecond) / DaySecondCounts);
	}

	public static int GetDiffDayNumFive(long time1, long time2) {
		return (int) ((time1 - centuryYearSecond - fiveSeconds) / DaySecondCounts) - (int) ((time2 - centuryYearSecond - fiveSeconds) / DaySecondCounts);
	}

	public static int GetDiffDayNumStandardFive(long time1, long time2) {
		return (int) ((time1 - centuryYearSecond - StandardFiveSeconds) / DaySecondCounts) - (int) ((time2 - centuryYearSecond - StandardFiveSeconds) / DaySecondCounts);
	}

	/**
	 * 通过时间秒毫秒数判断两个时间的间隔
	 * @param time1
	 * @param time2
	 * @return
	 */
	public static int differentDaysByMillisecond(long time1, long time2)
	{
		int days = (int) ((time1 - time2) / (DaySecondCounts));
		return days;
	}

	/**
	 * 当天的
	 * getNextTime: 获取一个时间搓  传递的是 时分秒
	 *
	 * @param hms
	 * @return int
	 */
	public static long getNowTime(String hms) {
		return getOldTime(currentTimeSeconds(), hms);
	}

	/**
	 * 当天的
	 * getNextTime: 获取一个时间搓  传递的是 今天的秒数 比如 10:00:00 这是 36000秒
	 *
	 * @param secondInt
	 * @return int
	 */
	public static long getNowTime(int secondInt) {
		return getNowDayZeroSecond() + secondInt;
	}

	/**
	 * 获得当前天 零点 的系统秒
	 *
	 * @return
	 */
	public static long getNowDayZeroSecond() {
		return (centuryYearSecond + ((currentTimeSeconds() - centuryYearSecond) / DaySecondCounts) * DaySecondCounts);
	}

	/**
	 * 获得明天零点 的系统秒
	 *
	 * @return
	 */
	public static long getTomorrowDayZeroSecond() {
		return getNowDayZeroSecond() + DaySecondCounts;
	}

	/**
	 * 指定的时间搓
	 *
	 * @param second 指定的时间 毫秒
	 * @param hms    时分秒
	 * @return
	 */
	public static long getOldTime(long second, String hms) {
		StringBuffer dateTime = new StringBuffer();
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(second, 0, zoneOffset);
		dateTime.append(dateTimeFormatter1.format(localDateTime)).append(" ").append(hms);
		return getTimeByString(dateTime.toString());
	}

	/**
	 * 通过时分 返回当前的一个时间搓
	 *
	 * @param hm
	 * @return
	 */
	public static long getNowTime1(String hm) {
		return getNowTime(hm + ":00");
	}

	/**
	 * 获取一个指定的时间的秒数
	 *
	 * @param timeStr
	 * @return
	 */
	public static long getTimeByString(String timeStr) {
		// 异常情况，便于通知上层
		long hmsTime = -1;
		try {
			LocalDateTime ldt = LocalDateTime.parse(timeStr, dateTimeFormatter);
			hmsTime = ldt.toEpochSecond(zoneOffset);
		} catch (Exception e) {
			log.error("[TimeUtils,getTimeByString]e ex:{}",e.toString());
		}
		return hmsTime;
	}

	/**
	 * 获取一个指定的时间的秒数
	 * 只包含小时分钟秒
	 *
	 * @param timeStr
	 * @return
	 */
	public static int getTimeByString2(String timeStr) {
		// 异常情况，便于通知上层
		int hmsTime = -1;
		try {

			LocalTime lt = LocalTime.parse(timeStr, timeFormatter);
			return lt.toSecondOfDay();
		} catch (Exception e) {
			log.error("[TimeUtils,getTimeByString2]e ex:{}", e.toString());
		}
		return hmsTime;
	}

	/**
	 * 获取某天开始的时刻
	 *
	 * @param second 秒
	 * @return 那天开始的时间轴时刻 单位秒
	 */
	public static long getTimesDayBeginSecond(long second) {
		return centuryYearSecond + ((second - centuryYearSecond) / DaySecondCounts) * DaySecondCounts;
	}

	public static long getTimesDayBeginSecondFive(long second) {
		return centuryYearSecond + ((second - centuryYearSecond) / DaySecondCounts) * DaySecondCounts + fiveSeconds;
	}

	public static long getTimesDayBeginSecondStandardFive(long second) {
		return centuryYearSecond + ((second - centuryYearSecond) / DaySecondCounts) * DaySecondCounts + StandardFiveSeconds;
	}

	/**
	 * 检查时间是否合法
	 *
	 * @param h
	 * @param m
	 * @return
	 */
	public static boolean checkTimeValid(int h, int m) {
		if (h < 0 || h > 23) {
			return false;
		}
		if (m < 0 || m > 59) {
			return false;
		}
		return true;
	}

	/**
	 * 获取通过小时   返回 今日hour点的时间戳
	 *
	 * @param hour
	 * @return
	 */
	public static long getTimesByHour(int hour) {
		return getTimesDayBeginSecond(currentTimeSeconds()) + hour * SECOND_PER_HOUR;
	}

	/**
	 * 当前周中日, 周几[1,7]
	 * 周一 - 周日  1 - 7
	 * 时间 是秒
	 *
	 * @return
	 */
	public static int getWeekDay(long second) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(second, 0, zoneOffset);
		return localDateTime.getDayOfWeek().getValue();
	}

	/**
	 * 当前周中日, 周几[1,7]  按照 凌晨5点开始算 当前时间 减去 5小时
	 * 周一 - 周日  1 - 7
	 * 时间 是秒
	 *
	 * @return
	 */
	public static int getWeekDay_Five(long second) {
		second = second - fiveSeconds;
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(second, 0, zoneOffset);
		return localDateTime.getDayOfWeek().getValue();
	}

	public static int getWeekDay() {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(currentTimeSeconds(), 0, zoneOffset);
		return localDateTime.getDayOfWeek().getValue();
	}

	public static int getWeekDayFive() {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(currentTimeSeconds(), 0, zoneOffsetFive);
		return localDateTime.getDayOfWeek().getValue();
	}

	/**
	 * 到 2019-07-01 00:00:00（这个时间点是周一） 的周 数   避免 跨年的问题
	 *
	 * @param time 秒
	 * @return
	 */
	public static int getWeekNumOfGameSetTime(long time) {
		return (int) ((time - centuryYearSecond) / (DaysOfAWeek * DaySecondCounts));
	}

	/**
	 * yyyy-MM-dd
	 *
	 * @param yyhhmmdd
	 * @return
	 */
	public static int between_days(String yyhhmmdd) {
		long timeSecond = 0;
		try {
			LocalDateTime ldt = LocalDateTime.parse(yyhhmmdd + " 00:00:00", dateTimeFormatter);
			timeSecond = ldt.toEpochSecond(zoneOffset);
		} catch (Exception e) {
			log.error("[TimeUtils,between_days]e ex:{}", e.toString());
		}
		long between_days = GetDiffDayNum(timeSecond, currentTimeSeconds());
		return (int) between_days;
	}

	/**
	 * 时间转换成字符串
	 *
	 * @param second
	 * @return
	 */
	public static String getDateStr(long second) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(second, 0, zoneOffset);
		return dateTimeFormatter.format(localDateTime);
	}

	/**
	 * 当前日期,精确到秒, 年月日格式, 格式: yyyyMMdd, 例如: 20161207
	 *
	 * @return
	 */
	public static long currentCHSYYMMDDHHMMSS() {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(currentTimeSeconds(), 0, zoneOffset);
		//201106 183010
		long ret = (localDateTime.getYear()%100) * 10000000000L +
				localDateTime.getMonthValue() * 100000000L +
				localDateTime.getDayOfMonth() * 1000000L +
				localDateTime.getHour() * 10000L +
				localDateTime.getMinute() * 100L +
				localDateTime.getSecond() * 1L ;
		return ret;
	}

	/**
	 * 当前日期,精确到秒, 年月日格式, 格式: yyyyMMdd, 例如: 2016/12/07 12:40:30
	 *
	 * @return
	 */
	public static String getCHSYYYYMMDDHHMMSS(long utcSeconds) {
		LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(utcSeconds, 0, zoneOffset);
		//201106 183010

		return dateTimeFormatterTencent.format(localDateTime);
	}

	/**
	 * 从过去到现在经历的天数， 按5点做每日分割
	 * @param nowTimeS unixTime seconds
	 * @param fromTimeS unixTime seconds
	 * @return
	 */
	public static long eclipseDaysFromFive(long nowTimeS, long fromTimeS){
		LocalDateTime nowTime = LocalDateTime.ofEpochSecond(nowTimeS - StandardFiveSeconds, 0, zoneOffset);
		nowTime = LocalDateTime.of(nowTime.toLocalDate(), LocalTime.MIN);
		LocalDateTime fromTime = LocalDateTime.ofEpochSecond(fromTimeS - StandardFiveSeconds, 0, zoneOffset);
		fromTime = LocalDateTime.of(fromTime.toLocalDate(), LocalTime.MIN);
		long days = fromTime.until( nowTime, ChronoUnit.DAYS);
		return days;
	}

	/**
	 * 从过去到现在经历的天数， 按0点做每日分割
	 * @param nowTimeS unixTime seconds
	 * @param fromTimeS unixTime seconds
	 * @return
	 */
	public static long eclipseDaysFromZero(long nowTimeS, long fromTimeS){
		LocalDateTime nowTime = LocalDateTime.ofEpochSecond(nowTimeS, 0, zoneOffset);
		nowTime = LocalDateTime.of(nowTime.toLocalDate(), LocalTime.MIN);
		LocalDateTime fromTime = LocalDateTime.ofEpochSecond(fromTimeS, 0, zoneOffset);
		fromTime = LocalDateTime.of(fromTime.toLocalDate(), LocalTime.MIN);
		long days = fromTime.until( nowTime, ChronoUnit.DAYS);
		return days;
	}

	/**
	 * 获取0点的Unixtime
	 * @param nowTimeS unixTime seconds
	 * @return
	 */
	public static long dayTimeAtZero(long nowTimeS){
		LocalDateTime nowTime = LocalDateTime.ofEpochSecond(nowTimeS, 0, zoneOffset);
		nowTime = LocalDateTime.of(nowTime.toLocalDate(), LocalTime.MIN);
		return nowTime.toEpochSecond(zoneOffset);
	}

	public static void main(String[] args) {
		long remainingSeconds = calculateRemainingSecondsUntilMidnight();
		System.out.println("剩余秒数：" + remainingSeconds);
	}

	public static long calculateRemainingSecondsUntilMidnight() {
		// 获取当前时间
		LocalDateTime currentTime = LocalDateTime.now();

		// 获取当日的0点时间
		LocalDateTime midnight = LocalDateTime.of(currentTime.toLocalDate(), LocalTime.MIDNIGHT);

		// 如果当前时间已经超过了当日的0点，则计算剩余秒数为到明天0点的秒数
		if (currentTime.isAfter(midnight)) {
			midnight = midnight.plusDays(1); // 到明天0点
		}

		// 计算剩余秒数
		long remainingSeconds = ChronoUnit.SECONDS.between(currentTime, midnight);

		return remainingSeconds;
	}
}



